Skip to content

Implement IntegerOverflow package #263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 37 commits into from
Mar 27, 2023
Merged

Implement IntegerOverflow package #263

merged 37 commits into from
Mar 27, 2023

Conversation

lcartey
Copy link
Collaborator

@lcartey lcartey commented Mar 21, 2023

Description

This PR implements the IntegerOverflow package. It mostly reuses concepts and code from previous work on C++ overflow queries, although notably it splits up the query IntegerExpressionLeadToDataLoss.ql into separate queries for (a) unsigned integer wrap (b) signed integer overflow/underflow, and adds a separate query for lossy integer conversions. We do this by adding a new Overflow.qll library. Other notable changes include some limited support for multiplication, and greater detection of pre and post checks as specified by CERT-C.

I have one further set of changes to make, which is to expand the Overflow.qll to cover unary negation and div/rem. Other than that this is ready to go.

Change request type

  • Release or process automation (GitHub workflows, internal scripts)
  • Internal documentation
  • External documentation
  • Query files (.ql, .qll, .qls or unit tests)
  • External scripts (analysis report or other code shipped as part of a release)

Rules with added or modified queries

  • No rules added
  • Queries have been added for the following rules:
    • INT30-C
    • INT31-C
    • INT32-C
    • INT33-C
    • INT35-C
    • Rule 12.4
  • Queries have been modified for the following rules:
    • rule number here

Release change checklist

A change note (development_handbook.md#change-notes) is required for any pull request which modifies:

  • The structure or layout of the release artifacts.
  • The evaluation performance (memory, execution time) of an existing query.
  • The results of an existing query in any circumstance.

If you are only adding new rule queries, a change note is not required.

Author: Is a change note required?

  • Yes
  • No

🚨🚨🚨
Reviewer: Confirm that format of shared queries (not the .qll file, the
.ql file that imports it) is valid by running them within VS Code.

  • Confirmed

Reviewer: Confirm that either a change note is not required or the change note is required and has been added.

  • Confirmed

Query development review checklist

For PRs that add new queries or modify existing queries, the following checklist should be completed by both the author and reviewer:

Author

  • Have all the relevant rule package description files been checked in?
  • Have you verified that the metadata properties of each new query is set appropriately?
  • Do all the unit tests contain both "COMPLIANT" and "NON_COMPLIANT" cases?
  • Are the alert messages properly formatted and consistent with the style guide?
  • Have you run the queries on OpenPilot and verified that the performance and results are acceptable?
    As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.
  • Does the query have an appropriate level of in-query comments/documentation?
  • Have you considered/identified possible edge cases?
  • Does the query not reinvent features in the standard library?
  • Can the query be simplified further (not golfed!)

Reviewer

  • Have all the relevant rule package description files been checked in?
  • Have you verified that the metadata properties of each new query is set appropriately?
  • Do all the unit tests contain both "COMPLIANT" and "NON_COMPLIANT" cases?
  • Are the alert messages properly formatted and consistent with the style guide?
  • Have you run the queries on OpenPilot and verified that the performance and results are acceptable?
    As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.
  • Does the query have an appropriate level of in-query comments/documentation?
  • Have you considered/identified possible edge cases?
  • Does the query not reinvent features in the standard library?
  • Can the query be simplified further (not golfed!)

lcartey added 20 commits March 21, 2023 23:28
Enable re-use of existing query by extracting out
"InterestingBinaryOverflowingExpr" to a separate library.
Adds a query for finding unsigned integer wraparound, based on the
`InterestingBinaryOverflowingExpr` class.
Adds a query to find div/rem by zero errors.
Implement Rule 12.4 by sharing a query with M5-19-1 for finding
constant integer expressions that wrap around.
Constant binary expressions which are immediately casted to a signed
type should not be excluded from this rule, because the "wrap" will
still occur.
For the "constantintegerexpressionswraparound" query, exclude results in
macros from third-party libraries which do not have any arguments, as
they are (a) not controlled by the user (b) likely intended or false
positives (such as UULONG_MAX).
Only applicable to unsigned operations
Adds a query to detect signed integer operation overflow/underflow.
Initially this only supports add and subtract operations, and detects
CERT recommended patterns of avoiding overflow/underflow.
Add support for `MulExpr`s to the overflow library.
Signed integer overflow and underflow is undefined behavior, and so,
unlike unsigned wraparound, it's not valid to do so even in a guard
condition.
Adds a query to detect conversions which could potentially lead to data
loss. This covers both explicit/implicit casts, and also calls to
functions which internal convert values.
Conversions to bool should be permitted because they are not "lossy".
Add query to find incorrect precision checks.
@lcartey lcartey requested a review from nicolaswill March 21, 2023 23:34
@github-actions
Copy link

🤖 Beep Boop! Matrix Testing for this PR has been initiated. Please check back later for results.

💡 If you do not hear back from me please check my status! I will report even if this PR does not contain files eligible for matrix testing.

@jsinglet
Copy link
Contributor

🤖 Beep Boop! qcc/cpp/AARCH64LE Matrix Testing for this PR won't happen because it is outside of license window!

@jsinglet
Copy link
Contributor

🤖 Beep Boop! qcc/c/AARCH64LE Matrix Testing for this PR won't happen because it is outside of license window!

@jsinglet
Copy link
Contributor

🤖 Beep Boop! gcc/cpp/X86_64 Matrix Testing for this PR has been completed. See below for the results!


QUERY                : IntMultToLong
RULE                 : A4-7-1
SUITE                : AUTOSAR
TEST_PASS            : True
PACKAGE              : IntegerConversion
TEST_DIFFERENCE      : 
COMPILE_ERROR_OUTPUT : 
COMPILE_PASS         : True

QUERY                : IntegerExpressionLeadToDataLoss
RULE                 : A4-7-1
SUITE                : AUTOSAR
TEST_PASS            : True
PACKAGE              : IntegerConversion
TEST_DIFFERENCE      : 
COMPILE_ERROR_OUTPUT : 
COMPILE_PASS         : True

QUERY                : TraditionalCStyleCastsUsed
RULE                 : A5-2-2
SUITE                : AUTOSAR
TEST_PASS            : True
PACKAGE              : BannedSyntax
TEST_DIFFERENCE      : 
COMPILE_ERROR_OUTPUT : 
COMPILE_PASS         : True

QUERY                : ConstantUnsignedIntegerExpressionsWrapAround
RULE                 : M5-19-1
SUITE                : AUTOSAR
TEST_PASS            : False
PACKAGE              : Expressions
TEST_DIFFERENCE      : --- expected
                       +++ actual
                       @@ -1,3 +1,5 @@
                       +| file:///usr/include/c++/8/limits:1208:44:1208:65 | ... + ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                       +| file:///usr/include/c++/8/limits:1351:44:1351:71 | ... + ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                        | test.cpp:16:7:16:50 | ... - ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                        | test.cpp:17:7:17:18 | ... + ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                        | test.cpp:23:7:23:19 | ... - ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                       [1/1 comp 28.1s eval 1s] FAILED(RESULT) /__w/codeql-coding-standards-release-engineering/codeql-coding-standards-release-engineering/codeql-coding-standards/cpp/common/test/rules/constantunsignedintegerexpressionswraparound/ConstantUnsignedIntegerExpressionsWrapAround.ql
                       
COMPILE_ERROR_OUTPUT : 
COMPILE_PASS         : True


@jsinglet
Copy link
Contributor

🤖 Beep Boop! clang/cpp/X86_64 Matrix Testing for this PR has been completed. See below for the results!


SUITE                : AUTOSAR
RULE                 : A4-7-1
TEST_PASS            : True
COMPILE_PASS         : True
QUERY                : IntMultToLong
COMPILE_ERROR_OUTPUT : 
TEST_DIFFERENCE      : 
PACKAGE              : IntegerConversion

SUITE                : AUTOSAR
RULE                 : A4-7-1
TEST_PASS            : True
COMPILE_PASS         : True
QUERY                : IntegerExpressionLeadToDataLoss
COMPILE_ERROR_OUTPUT : 
TEST_DIFFERENCE      : 
PACKAGE              : IntegerConversion

SUITE                : AUTOSAR
RULE                 : A5-2-2
TEST_PASS            : True
COMPILE_PASS         : True
QUERY                : TraditionalCStyleCastsUsed
COMPILE_ERROR_OUTPUT : 
TEST_DIFFERENCE      : 
PACKAGE              : BannedSyntax

SUITE                : AUTOSAR
RULE                 : M5-19-1
TEST_PASS            : False
COMPILE_PASS         : True
QUERY                : ConstantUnsignedIntegerExpressionsWrapAround
COMPILE_ERROR_OUTPUT : 
TEST_DIFFERENCE      : --- expected
                       +++ actual
                       @@ -1,3 +1,5 @@
                       +| file:///usr/include/c++/9/limits:1274:44:1274:65 | ... + ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                       +| file:///usr/include/c++/9/limits:1417:44:1417:71 | ... + ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                        | test.cpp:16:7:16:50 | ... - ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                        | test.cpp:17:7:17:18 | ... + ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                        | test.cpp:23:7:23:19 | ... - ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                       [1/1 comp 29.8s eval 1.3s] FAILED(RESULT) /__w/codeql-coding-standards-release-engineering/codeql-coding-standards-release-engineering/codeql-coding-standards/cpp/common/test/rules/constantunsignedintegerexpressionswraparound/ConstantUnsignedIntegerExpressionsWrapAround.ql
                       
PACKAGE              : Expressions


@jsinglet
Copy link
Contributor

🤖 Beep Boop! clang/c/X86_64 Matrix Testing for this PR has been completed. See below for the results!


PACKAGE              : IntegerOverflow
TEST_DIFFERENCE      : 
RULE                 : INT30-C
COMPILE_ERROR_OUTPUT : 
TEST_PASS            : True
QUERY                : UnsignedIntegerOperationsWrapAround
SUITE                : CERT-C
COMPILE_PASS         : True

PACKAGE              : IntegerOverflow
TEST_DIFFERENCE      : 
RULE                 : INT31-C
COMPILE_ERROR_OUTPUT : 
TEST_PASS            : True
QUERY                : IntegerConversionCausesDataLoss
SUITE                : CERT-C
COMPILE_PASS         : True

PACKAGE              : IntegerOverflow
TEST_DIFFERENCE      : 
RULE                 : INT32-C
COMPILE_ERROR_OUTPUT : 
TEST_PASS            : True
QUERY                : SignedIntegerOverflow
SUITE                : CERT-C
COMPILE_PASS         : True

PACKAGE              : IntegerOverflow
TEST_DIFFERENCE      : 
RULE                 : INT33-C
COMPILE_ERROR_OUTPUT : 
TEST_PASS            : True
QUERY                : DivOrRemByZero
SUITE                : CERT-C
COMPILE_PASS         : True

PACKAGE              : IntegerOverflow
TEST_DIFFERENCE      : 
RULE                 : INT35-C
COMPILE_ERROR_OUTPUT : 
TEST_PASS            : True
QUERY                : UseCorrectIntegerPrecisions
SUITE                : CERT-C
COMPILE_PASS         : True

PACKAGE              : IntegerOverflow
TEST_DIFFERENCE      : 
RULE                 : RULE-12-4
COMPILE_ERROR_OUTPUT : 
TEST_PASS            : True
QUERY                : ConstantUnsignedIntegerExpressionsWrapAround
SUITE                : MISRA-C-2012
COMPILE_PASS         : True


@jsinglet
Copy link
Contributor

🤖 Beep Boop! gcc/c/X86_64 Matrix Testing for this PR has been completed. See below for the results!


TEST_DIFFERENCE      : 
COMPILE_ERROR_OUTPUT : 
SUITE                : CERT-C
QUERY                : UnsignedIntegerOperationsWrapAround
RULE                 : INT30-C
PACKAGE              : IntegerOverflow
COMPILE_PASS         : True
TEST_PASS            : True

TEST_DIFFERENCE      : 
COMPILE_ERROR_OUTPUT : 
SUITE                : CERT-C
QUERY                : IntegerConversionCausesDataLoss
RULE                 : INT31-C
PACKAGE              : IntegerOverflow
COMPILE_PASS         : True
TEST_PASS            : True

TEST_DIFFERENCE      : 
COMPILE_ERROR_OUTPUT : 
SUITE                : CERT-C
QUERY                : SignedIntegerOverflow
RULE                 : INT32-C
PACKAGE              : IntegerOverflow
COMPILE_PASS         : True
TEST_PASS            : True

TEST_DIFFERENCE      : 
COMPILE_ERROR_OUTPUT : 
SUITE                : CERT-C
QUERY                : DivOrRemByZero
RULE                 : INT33-C
PACKAGE              : IntegerOverflow
COMPILE_PASS         : True
TEST_PASS            : True

TEST_DIFFERENCE      : 
COMPILE_ERROR_OUTPUT : 
SUITE                : CERT-C
QUERY                : UseCorrectIntegerPrecisions
RULE                 : INT35-C
PACKAGE              : IntegerOverflow
COMPILE_PASS         : True
TEST_PASS            : True

TEST_DIFFERENCE      : 
COMPILE_ERROR_OUTPUT : 
SUITE                : MISRA-C-2012
QUERY                : ConstantUnsignedIntegerExpressionsWrapAround
RULE                 : RULE-12-4
PACKAGE              : IntegerOverflow
COMPILE_PASS         : True
TEST_PASS            : True


@jsinglet
Copy link
Contributor

🤖 Beep Boop! Matrix Testing for this PR has been completed. If no reports were posted it means this PR does not contain things that need matrix testing!

Copy link
Contributor

@nicolaswill nicolaswill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes LGTM, but they also changed the behaviour of A4-7-1:

void test_addition_loop_bound(unsigned int base, unsigned int size) {
  if (size > 0) {
    int n = size - 1;
    for (int i = 0; i < n; i++) {
      base + i; // COMPLIANT - `i` is bounded
    }
  }
}

A previous false-negative (not in that snippet) as well as the for loop in the snippet above and the statement within it are now included as results. The base + i result looks like a true positive to me: base is not bounded, so wrapping could occur. I believe that the for loop's condition prevents i from ever overflowing, so that result is a false-positive. Agreed?

I think there should also be short change note documenting the changes affecting A4-7-1.

lcartey added 4 commits March 27, 2023 10:16
Due to widening in loops, SimpleRangeAnalysis is overly cautious about
crement operations in loop updates. This commit makes some small
adjustments to identify "safe" crement operations that cannot overflow
due to the bounding by the loop counters.
Add support for + and - guards related to checking operands relative to
each other.
@github-actions
Copy link

🤖 Beep Boop! Matrix Testing for this PR has been initiated. Please check back later for results.

💡 If you do not hear back from me please check my status! I will report even if this PR does not contain files eligible for matrix testing.

@lcartey lcartey requested a review from nicolaswill March 27, 2023 11:38
@jsinglet
Copy link
Contributor

🤖 Beep Boop! qcc/cpp/AARCH64LE Matrix Testing for this PR won't happen because it is outside of license window!

@jsinglet
Copy link
Contributor

🤖 Beep Boop! qcc/c/AARCH64LE Matrix Testing for this PR won't happen because it is outside of license window!

@lcartey
Copy link
Collaborator Author

lcartey commented Mar 27, 2023

@kraiouchkine:

  • I've fixed up the behaviour of crement operations in loops with a special case analysis.
  • Modified the A4-7-1 tests to ensure it's clear what we're testing in each case, and added more tests for crement operators.
  • Added more support for guards on ...+... and ...-... operations.

@jsinglet
Copy link
Contributor

🤖 Beep Boop! gcc/cpp/X86_64 Matrix Testing for this PR has been completed. See below for the results!


COMPILE_ERROR_OUTPUT : 
COMPILE_PASS         : True
TEST_PASS            : True
RULE                 : A4-7-1
TEST_DIFFERENCE      : 
PACKAGE              : IntegerConversion
QUERY                : IntMultToLong
SUITE                : AUTOSAR

COMPILE_ERROR_OUTPUT : 
COMPILE_PASS         : True
TEST_PASS            : True
RULE                 : A4-7-1
TEST_DIFFERENCE      : 
PACKAGE              : IntegerConversion
QUERY                : IntegerExpressionLeadToDataLoss
SUITE                : AUTOSAR

COMPILE_ERROR_OUTPUT : 
COMPILE_PASS         : True
TEST_PASS            : True
RULE                 : A5-2-2
TEST_DIFFERENCE      : 
PACKAGE              : BannedSyntax
QUERY                : TraditionalCStyleCastsUsed
SUITE                : AUTOSAR

COMPILE_ERROR_OUTPUT : 
COMPILE_PASS         : True
TEST_PASS            : False
RULE                 : M5-19-1
TEST_DIFFERENCE      : --- expected
                       +++ actual
                       @@ -1,3 +1,5 @@
                       +| file:///usr/include/c++/8/limits:1208:44:1208:65 | ... + ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                       +| file:///usr/include/c++/8/limits:1351:44:1351:71 | ... + ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                        | test.cpp:16:7:16:50 | ... - ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                        | test.cpp:17:7:17:18 | ... + ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                        | test.cpp:23:7:23:19 | ... - ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                       [1/1 comp 30.1s eval 1.1s] FAILED(RESULT) /__w/codeql-coding-standards-release-engineering/codeql-coding-standards-release-engineering/codeql-coding-standards/cpp/common/test/rules/constantunsignedintegerexpressionswraparound/ConstantUnsignedIntegerExpressionsWrapAround.ql
                       
PACKAGE              : Expressions
QUERY                : ConstantUnsignedIntegerExpressionsWrapAround
SUITE                : AUTOSAR


@jsinglet
Copy link
Contributor

🤖 Beep Boop! clang/cpp/X86_64 Matrix Testing for this PR has been completed. See below for the results!


PACKAGE              : IntegerConversion
QUERY                : IntMultToLong
COMPILE_ERROR_OUTPUT : 
TEST_DIFFERENCE      : 
COMPILE_PASS         : True
RULE                 : A4-7-1
SUITE                : AUTOSAR
TEST_PASS            : True

PACKAGE              : IntegerConversion
QUERY                : IntegerExpressionLeadToDataLoss
COMPILE_ERROR_OUTPUT : 
TEST_DIFFERENCE      : 
COMPILE_PASS         : True
RULE                 : A4-7-1
SUITE                : AUTOSAR
TEST_PASS            : True

PACKAGE              : BannedSyntax
QUERY                : TraditionalCStyleCastsUsed
COMPILE_ERROR_OUTPUT : 
TEST_DIFFERENCE      : 
COMPILE_PASS         : True
RULE                 : A5-2-2
SUITE                : AUTOSAR
TEST_PASS            : True

PACKAGE              : Expressions
QUERY                : ConstantUnsignedIntegerExpressionsWrapAround
COMPILE_ERROR_OUTPUT : 
TEST_DIFFERENCE      : --- expected
                       +++ actual
                       @@ -1,3 +1,5 @@
                       +| file:///usr/include/c++/9/limits:1274:44:1274:65 | ... + ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                       +| file:///usr/include/c++/9/limits:1417:44:1417:71 | ... + ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                        | test.cpp:16:7:16:50 | ... - ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                        | test.cpp:17:7:17:18 | ... + ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                        | test.cpp:23:7:23:19 | ... - ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                       [1/1 comp 31.6s eval 1.2s] FAILED(RESULT) /__w/codeql-coding-standards-release-engineering/codeql-coding-standards-release-engineering/codeql-coding-standards/cpp/common/test/rules/constantunsignedintegerexpressionswraparound/ConstantUnsignedIntegerExpressionsWrapAround.ql
                       
COMPILE_PASS         : True
RULE                 : M5-19-1
SUITE                : AUTOSAR
TEST_PASS            : False


@github-actions
Copy link

🤖 Beep Boop! Matrix Testing for this PR has been initiated. Please check back later for results.

💡 If you do not hear back from me please check my status! I will report even if this PR does not contain files eligible for matrix testing.

@jsinglet
Copy link
Contributor

🤖 Beep Boop! gcc/c/X86_64 Matrix Testing for this PR has been completed. See below for the results!


TEST_PASS            : True
COMPILE_ERROR_OUTPUT : 
QUERY                : UnsignedIntegerOperationsWrapAround
RULE                 : INT30-C
TEST_DIFFERENCE      : 
COMPILE_PASS         : True
PACKAGE              : IntegerOverflow
SUITE                : CERT-C

TEST_PASS            : True
COMPILE_ERROR_OUTPUT : 
QUERY                : IntegerConversionCausesDataLoss
RULE                 : INT31-C
TEST_DIFFERENCE      : 
COMPILE_PASS         : True
PACKAGE              : IntegerOverflow
SUITE                : CERT-C

TEST_PASS            : True
COMPILE_ERROR_OUTPUT : 
QUERY                : SignedIntegerOverflow
RULE                 : INT32-C
TEST_DIFFERENCE      : 
COMPILE_PASS         : True
PACKAGE              : IntegerOverflow
SUITE                : CERT-C

TEST_PASS            : True
COMPILE_ERROR_OUTPUT : 
QUERY                : DivOrRemByZero
RULE                 : INT33-C
TEST_DIFFERENCE      : 
COMPILE_PASS         : True
PACKAGE              : IntegerOverflow
SUITE                : CERT-C

TEST_PASS            : True
COMPILE_ERROR_OUTPUT : 
QUERY                : UseCorrectIntegerPrecisions
RULE                 : INT35-C
TEST_DIFFERENCE      : 
COMPILE_PASS         : True
PACKAGE              : IntegerOverflow
SUITE                : CERT-C

TEST_PASS            : True
COMPILE_ERROR_OUTPUT : 
QUERY                : ConstantUnsignedIntegerExpressionsWrapAround
RULE                 : RULE-12-4
TEST_DIFFERENCE      : 
COMPILE_PASS         : True
PACKAGE              : IntegerOverflow
SUITE                : MISRA-C-2012


@jsinglet
Copy link
Contributor

🤖 Beep Boop! clang/c/X86_64 Matrix Testing for this PR has been completed. See below for the results!


QUERY                : UnsignedIntegerOperationsWrapAround
TEST_PASS            : True
SUITE                : CERT-C
COMPILE_PASS         : True
PACKAGE              : IntegerOverflow
TEST_DIFFERENCE      : 
RULE                 : INT30-C
COMPILE_ERROR_OUTPUT : 

QUERY                : IntegerConversionCausesDataLoss
TEST_PASS            : True
SUITE                : CERT-C
COMPILE_PASS         : True
PACKAGE              : IntegerOverflow
TEST_DIFFERENCE      : 
RULE                 : INT31-C
COMPILE_ERROR_OUTPUT : 

QUERY                : SignedIntegerOverflow
TEST_PASS            : True
SUITE                : CERT-C
COMPILE_PASS         : True
PACKAGE              : IntegerOverflow
TEST_DIFFERENCE      : 
RULE                 : INT32-C
COMPILE_ERROR_OUTPUT : 

QUERY                : DivOrRemByZero
TEST_PASS            : True
SUITE                : CERT-C
COMPILE_PASS         : True
PACKAGE              : IntegerOverflow
TEST_DIFFERENCE      : 
RULE                 : INT33-C
COMPILE_ERROR_OUTPUT : 

QUERY                : UseCorrectIntegerPrecisions
TEST_PASS            : True
SUITE                : CERT-C
COMPILE_PASS         : True
PACKAGE              : IntegerOverflow
TEST_DIFFERENCE      : 
RULE                 : INT35-C
COMPILE_ERROR_OUTPUT : 

QUERY                : ConstantUnsignedIntegerExpressionsWrapAround
TEST_PASS            : True
SUITE                : MISRA-C-2012
COMPILE_PASS         : True
PACKAGE              : IntegerOverflow
TEST_DIFFERENCE      : 
RULE                 : RULE-12-4
COMPILE_ERROR_OUTPUT : 


@jsinglet
Copy link
Contributor

🤖 Beep Boop! Matrix Testing for this PR has been completed. If no reports were posted it means this PR does not contain things that need matrix testing!

@jsinglet
Copy link
Contributor

🤖 Beep Boop! qcc/cpp/AARCH64LE Matrix Testing for this PR won't happen because it is outside of license window!

@jsinglet
Copy link
Contributor

🤖 Beep Boop! qcc/c/AARCH64LE Matrix Testing for this PR won't happen because it is outside of license window!

@jsinglet
Copy link
Contributor

🤖 Beep Boop! clang/cpp/X86_64 Matrix Testing for this PR has been completed. See below for the results!


COMPILE_PASS         : True
TEST_PASS            : True
TEST_DIFFERENCE      : 
SUITE                : AUTOSAR
PACKAGE              : IntegerConversion
QUERY                : IntMultToLong
COMPILE_ERROR_OUTPUT : 
RULE                 : A4-7-1

COMPILE_PASS         : True
TEST_PASS            : True
TEST_DIFFERENCE      : 
SUITE                : AUTOSAR
PACKAGE              : IntegerConversion
QUERY                : IntegerExpressionLeadToDataLoss
COMPILE_ERROR_OUTPUT : 
RULE                 : A4-7-1

COMPILE_PASS         : True
TEST_PASS            : True
TEST_DIFFERENCE      : 
SUITE                : AUTOSAR
PACKAGE              : BannedSyntax
QUERY                : TraditionalCStyleCastsUsed
COMPILE_ERROR_OUTPUT : 
RULE                 : A5-2-2

COMPILE_PASS         : True
TEST_PASS            : False
TEST_DIFFERENCE      : --- expected
                       +++ actual
                       @@ -1,3 +1,5 @@
                       +| file:///usr/include/c++/9/limits:1274:44:1274:65 | ... + ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                       +| file:///usr/include/c++/9/limits:1417:44:1417:71 | ... + ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                        | test.cpp:16:7:16:50 | ... - ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                        | test.cpp:17:7:17:18 | ... + ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                        | test.cpp:23:7:23:19 | ... - ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                       [1/1 comp 28.4s eval 1.3s] FAILED(RESULT) /__w/codeql-coding-standards-release-engineering/codeql-coding-standards-release-engineering/codeql-coding-standards/cpp/common/test/rules/constantunsignedintegerexpressionswraparound/ConstantUnsignedIntegerExpressionsWrapAround.ql
                       
SUITE                : AUTOSAR
PACKAGE              : Expressions
QUERY                : ConstantUnsignedIntegerExpressionsWrapAround
COMPILE_ERROR_OUTPUT : 
RULE                 : M5-19-1


@jsinglet
Copy link
Contributor

🤖 Beep Boop! gcc/cpp/X86_64 Matrix Testing for this PR has been completed. See below for the results!


COMPILE_ERROR_OUTPUT : 
SUITE                : AUTOSAR
TEST_PASS            : True
COMPILE_PASS         : True
RULE                 : A4-7-1
TEST_DIFFERENCE      : 
QUERY                : IntMultToLong
PACKAGE              : IntegerConversion

COMPILE_ERROR_OUTPUT : 
SUITE                : AUTOSAR
TEST_PASS            : True
COMPILE_PASS         : True
RULE                 : A4-7-1
TEST_DIFFERENCE      : 
QUERY                : IntegerExpressionLeadToDataLoss
PACKAGE              : IntegerConversion

COMPILE_ERROR_OUTPUT : 
SUITE                : AUTOSAR
TEST_PASS            : True
COMPILE_PASS         : True
RULE                 : A5-2-2
TEST_DIFFERENCE      : 
QUERY                : TraditionalCStyleCastsUsed
PACKAGE              : BannedSyntax

COMPILE_ERROR_OUTPUT : 
SUITE                : AUTOSAR
TEST_PASS            : False
COMPILE_PASS         : True
RULE                 : M5-19-1
TEST_DIFFERENCE      : --- expected
                       +++ actual
                       @@ -1,3 +1,5 @@
                       +| file:///usr/include/c++/8/limits:1208:44:1208:65 | ... + ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                       +| file:///usr/include/c++/8/limits:1351:44:1351:71 | ... + ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                        | test.cpp:16:7:16:50 | ... - ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                        | test.cpp:17:7:17:18 | ... + ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                        | test.cpp:23:7:23:19 | ... - ... | Use of a constant, unsigned, integer expression that over- or under-flows. |
                       [1/1 comp 30.1s eval 1.1s] FAILED(RESULT) /__w/codeql-coding-standards-release-engineering/codeql-coding-standards-release-engineering/codeql-coding-standards/cpp/common/test/rules/constantunsignedintegerexpressionswraparound/ConstantUnsignedIntegerExpressionsWrapAround.ql
                       
QUERY                : ConstantUnsignedIntegerExpressionsWrapAround
PACKAGE              : Expressions


@jsinglet
Copy link
Contributor

🤖 Beep Boop! clang/c/X86_64 Matrix Testing for this PR has been completed. See below for the results!


COMPILE_PASS         : True
RULE                 : INT30-C
COMPILE_ERROR_OUTPUT : 
TEST_DIFFERENCE      : 
QUERY                : UnsignedIntegerOperationsWrapAround
PACKAGE              : IntegerOverflow
TEST_PASS            : True
SUITE                : CERT-C

COMPILE_PASS         : True
RULE                 : INT31-C
COMPILE_ERROR_OUTPUT : 
TEST_DIFFERENCE      : 
QUERY                : IntegerConversionCausesDataLoss
PACKAGE              : IntegerOverflow
TEST_PASS            : True
SUITE                : CERT-C

COMPILE_PASS         : True
RULE                 : INT32-C
COMPILE_ERROR_OUTPUT : 
TEST_DIFFERENCE      : 
QUERY                : SignedIntegerOverflow
PACKAGE              : IntegerOverflow
TEST_PASS            : True
SUITE                : CERT-C

COMPILE_PASS         : True
RULE                 : INT33-C
COMPILE_ERROR_OUTPUT : 
TEST_DIFFERENCE      : 
QUERY                : DivOrRemByZero
PACKAGE              : IntegerOverflow
TEST_PASS            : True
SUITE                : CERT-C

COMPILE_PASS         : True
RULE                 : INT35-C
COMPILE_ERROR_OUTPUT : 
TEST_DIFFERENCE      : 
QUERY                : UseCorrectIntegerPrecisions
PACKAGE              : IntegerOverflow
TEST_PASS            : True
SUITE                : CERT-C

COMPILE_PASS         : True
RULE                 : RULE-12-4
COMPILE_ERROR_OUTPUT : 
TEST_DIFFERENCE      : 
QUERY                : ConstantUnsignedIntegerExpressionsWrapAround
PACKAGE              : IntegerOverflow
TEST_PASS            : True
SUITE                : MISRA-C-2012


@jsinglet
Copy link
Contributor

🤖 Beep Boop! gcc/c/X86_64 Matrix Testing for this PR has been completed. See below for the results!


QUERY                : UnsignedIntegerOperationsWrapAround
TEST_PASS            : True
COMPILE_ERROR_OUTPUT : 
COMPILE_PASS         : True
TEST_DIFFERENCE      : 
RULE                 : INT30-C
SUITE                : CERT-C
PACKAGE              : IntegerOverflow

QUERY                : IntegerConversionCausesDataLoss
TEST_PASS            : True
COMPILE_ERROR_OUTPUT : 
COMPILE_PASS         : True
TEST_DIFFERENCE      : 
RULE                 : INT31-C
SUITE                : CERT-C
PACKAGE              : IntegerOverflow

QUERY                : SignedIntegerOverflow
TEST_PASS            : True
COMPILE_ERROR_OUTPUT : 
COMPILE_PASS         : True
TEST_DIFFERENCE      : 
RULE                 : INT32-C
SUITE                : CERT-C
PACKAGE              : IntegerOverflow

QUERY                : DivOrRemByZero
TEST_PASS            : True
COMPILE_ERROR_OUTPUT : 
COMPILE_PASS         : True
TEST_DIFFERENCE      : 
RULE                 : INT33-C
SUITE                : CERT-C
PACKAGE              : IntegerOverflow

QUERY                : UseCorrectIntegerPrecisions
TEST_PASS            : True
COMPILE_ERROR_OUTPUT : 
COMPILE_PASS         : True
TEST_DIFFERENCE      : 
RULE                 : INT35-C
SUITE                : CERT-C
PACKAGE              : IntegerOverflow

QUERY                : ConstantUnsignedIntegerExpressionsWrapAround
TEST_PASS            : True
COMPILE_ERROR_OUTPUT : 
COMPILE_PASS         : True
TEST_DIFFERENCE      : 
RULE                 : RULE-12-4
SUITE                : MISRA-C-2012
PACKAGE              : IntegerOverflow


@jsinglet
Copy link
Contributor

🤖 Beep Boop! Matrix Testing for this PR has been completed. If no reports were posted it means this PR does not contain things that need matrix testing!

Copy link
Contributor

@nicolaswill nicolaswill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@lcartey lcartey enabled auto-merge March 27, 2023 13:19
@lcartey lcartey added this pull request to the merge queue Mar 27, 2023
Merged via the queue into main with commit 9822ec6 Mar 27, 2023
@lcartey lcartey deleted the lcartey/integer-overflow branch March 27, 2023 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

3 participants